Command Line Tools

Code
Powershell
Published

January 30, 2025

1. Setup

2. Basic Tools

function new {
    param(
        [Parameter(Mandatory)]
        [string]$Name
    )

    if ($Name -match '\.') {
        # Contains a dot, assume it's a file
        New-Item -Path $Name -ItemType File -Force
    } else {
        # No dot, assume it's a directory
        New-Item -Path $Name -ItemType Directory -Force
    }
}

3. Application Tools

4. Commons

  • code (Open With Visual Studio Code)
  • h (history)
  • cls (clear)
  • pwd print current directory
  • ipconfig /flushdns
  • netsh interface ip show dns
  • netsh wlan show profiles
  • netsh wlan show profile name="Wi-Fi_Name" key=clear
  • ping
  • ssh
  • ssh-keygen
  • ftp
  • robocopy
  • ps Get-Process
  • kill Stop-Process
  • gc -head 10 Get-Content (head)
  • gc -tail 10 Get-Content (tail)
  • Rename-Item old_name new_name (mv)
  • Get-Alias

5. Git

https://git-scm.com/downloads/win

  • .git
  • .gitignore
git init
git add # add files to staging area
git commit -m "..." # commit to local repo

git clone
git push origin main
git push origin
git push
git pull # fetch and merge
git fetch
git merge
git rebase

git branch
git checkout
git merge

git status
git log
git diff

6. Win + R

  • shell:startup
  • %USERPROFILE%
  • %USERPROFILE%/Desktop
  • %USERPROFILE%/Downloads
  • %USERPROFILE%/Documents
  • %USERPROFILE%/Pictures
  • %ALLUSERSPROFILE%
  • %APPDATA%
  • %LOCALAPPDATA%
  • %WINDIR%
  • %WINDIR%\system32
  • %WINDIR%\system32\drivers\etc\hosts
  • %PROGRAMFILES%
  • %PROGRAMFILES(X86)%
  • %TEMP%